package com.hdd.art.biz.member.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdd.art.biz.member.dto.MemberDo;
import com.hdd.art.biz.member.entity.Member;
import com.hdd.art.biz.member.mapper.MemberMapper;
import com.hdd.art.biz.member.service.MemberService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统用户表 服务实现类
 * </p>
 *
 * @author fang
 * @since 2021-06-27
 */
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {


    @Override
    public void insertMember(Member member) {
        baseMapper.insert(member);
    }

    @Override
    public Member findMemberByUserId(MemberDo memberDo) {
        QueryWrapper<Member> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",memberDo.getUserId());
        return  baseMapper.selectOne(wrapper);
    }


    @Override
    public void udpateMember(Member member) {
        QueryWrapper<Member> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",member.getUserId());
        baseMapper.update(member,wrapper);
    }

    @Override
    public void updateHead(Member member) {
        QueryWrapper<Member> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",member.getUserId());
        baseMapper.update(member,wrapper);
    }
}
